<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta charset="utf-8">
		<title>企业管理系统</title>
		 <!--
		       引入CSS和JS文件
		  -->
		<link rel="stylesheet" href="css/login.css" />
		<link rel="stylesheet" href="layui/css/layui.css" />
		<script type="text/javascript" src="layui/layui.js" ></script>
		<script type="text/javascript" src="js/global.js" ></script>
		
	</head>

	<body class="login-bg">
		<canvas id="fullstarbg">你的浏览器不支持canvas标签</canvas>
		<div class="login">
			<div class="message">企业管理系统登录</div>
			<div id="darkbannerwrap"></div>
			<form method="post" id="fmLogin" class="layui-form" onsubmit="return false;">
				<input name="username" placeholder="用户名" id="username" type="text" lay-verify="required" class="layui-input">
				<hr class="hr15">
				<input name="pwd" id="pwd" lay-verify="required" placeholder="密码" type="password" class="layui-input">
				<hr class="hr15">
				<input value="登录" lay-submit lay-filter="login" style="width:100%;" type="submit">
				<hr class="hr20">
			</form>
		</div>
	</body>
	
	<script type="text/javascript">
		layui.use(['form','layer','jquery'],function(){
			//加载form组件
			var form = layui.form;
			//加载jquery
			var $ = layui.$;
			
			form.on('submit(login)',function(data){
				//封装参数
				var param = {
					'username':$('#username').val(),
					'pwd':$('#pwd').val(),
					'token':globalData.myToken
				};
				//定义接口地址
				var login_url = "LoginServlet?url=login";
				//调用登陆的接口
				$.post(login_url,param,function(res){
					if(res.success){
						window.location = 'backindex.jsp';
					}else{
						layer.msg('登陆失败');
					}
				},'json');
				
				return false;
				
			});
			
			
		});
	</script>
	
</html>